package user

import (
	"k8s-dash/config"
	"k8s-dash/utils"
)

type user struct{}

var User user

func (u *user) Login(username, password string) (string, error) {
	token, err := utils.GenerateToken(username)
	if err != nil {
		return "", err
	}
	if username == config.SysConfig.Users.Username && password == config.SysConfig.Users.Password {
		return token, nil
	}
	return "", nil
}
